<?php 
$GLOBALS['Md'] = "TimeClock";
$GLOBALS['Pd'] = "B";
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
print heade(); 
print body(); 
module($BSD['DB00']);
office_header($_SESSION[$SESSOF]);
include($GLOBALS['PAD']."Modules/TimeClock/main.obj.php");
include($GLOBALS['PAD']."Modules/TimeClock/nav.views.php");
include($GLOBALS['PAD']."Modules/CentrodeCustos/func.php");
print NavBack();

	if (!isset($_POST['TimeStart'])) {
	$_POST['TimeStart'] = date("Y-m-01");
	} 
	if (!isset($_POST['TimeEnd'])) {
	$_POST['TimeEnd'] = date("Y-m-d");
	} 

	$sysTime = date("Y-m-d H:i:s");
	include($GLOBALS['PAD'].'Modules/TimeClock/Backoffice/pr_vacs.mex');
?>
<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
 
<table width="100%"  border="0" cellpadding="10">
  <tr>
    <td>
	<?php form_pr('VacGest','ED',$_SERVER['PHP_SELF'],'post'); ?>
	<div id="vacs_action">	
      <table width="100%"  border="0" cellpadding="3" cellspacing="1">
          <tr bgcolor="#99CCCC">
            <td bgcolor="#ACB1CC" colspan="2">
			<?php mn_field('button','ED','VCREQ','Marcar Férias','','','','" onclick="
			

replaceUrl(\'vacs_action\',\''.$GLOBALS['URL'].'Modules/TimeClock/Backoffice/add_vacs.mex\');'); ?></td>
          </tr>
      </table>	
	</div>
	</form>
	<div id="VacsConsole"><?php include($GLOBALS['PAD'].'Modules/TimeClock/Backoffice/vacs.mex');?></div>
	<br>
	<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="getData">
	<table width="100%"  border="0" cellpadding="3" cellspacing="1">
        <tr bgcolor="#ACB1CC">
          <td colspan="7">Pedidos para aprovação </td>
          <td><a href="../Templates/vacprint.php" target="_blank">Imprimir</a></td>
        </tr>
        <tr bgcolor="#F2F2F2">
          <td width="12%">Aprovar</td>
          <td width="15%">Funcionário</td>
          <td width="15%">Departamento</td>
          <td width="10%">Início</td>
          <td width="10%">Fim</td>
		  <td width="5%">Faltas</td>
		  <td width="28%">ObservaÇ&otilde;es</td>
		  <td width="20%">Justificação</td>
		  </tr>
   <?php
	   $Vacs = $GLOBALS['CONN']->db_array("SELECT 
						timeclock_vacs.ref AS vcref,
						timeclock_vacs.TimeStart,
						timeclock_vacs.TimeEnd,
						timeclock_vacs.Days,
						timeclock_vacs.Status,
						timeclock_vacs.Observations,
						main_offices.name AS office, main_users.name AS name,
						 timeclock_profiles.ref,
						 timeclock_profiles.main_users_ref,
						 timeclock_profiles.delay,
						 timeclock_profiles.mon1,
						 timeclock_profiles.mon2,
						 timeclock_profiles.mon3,
						 timeclock_profiles.mon4,
						 timeclock_profiles.mon5,
						 timeclock_profiles.mon6,
						 timeclock_profiles.mon0,
						 timeclock_profiles.ProfileType
				FROM timeclock_vacs
		INNER JOIN timeclock_profiles ON timeclock_profiles.main_users_ref = timeclock_vacs.RefUser
		INNER JOIN main_users ON main_users.ref = timeclock_profiles.main_users_ref
		INNER JOIN main_offices ON main_users.ref_office = main_offices.ref
		WHERE timeclock_vacs.Type = 1
		AND timeclock_vacs.Status < 2");
		for ($f = 1; $f <= $Vacs[0]; $f++) { ?>
	    <tr bgcolor="#F2F2F2">
          <td><?php 
		  $Qur = "Sem Ac��o;Aceite;Rejeitado;Pedente#".$Vacs[$f]['vcref'].'-1;'.$Vacs[$f]['vcref'].'-4;'.$Vacs[$f]['vcref'].'-2;'.$Vacs[$f]['vcref'].'-3;';
		  mn_field('hselect','ED','Aprov[]',$Vacs[$f]['Status'],$Qur,'','',''); ?></td>
          <td><?php echo $Vacs[$f]['name'];?></td>
          <td><?php echo $Vacs[$f]['office'];?></td>
          <td><?php $Start = split(" ",$Vacs[$f]['TimeStart']);
		  			print $Start[0]; ?></td>
          <td><?php $End = split(" ",$Vacs[$f]['TimeEnd']);
		  			print $End[0]; ?></td>
		  <td></td>
		  <td><?php echo $Vacs[$f]['Observations'];?></td>
		  <td><textarea name="Justification[]" cols="20" id="Justification[]"></textarea></td>
		  </tr>
	<?php } ?>
		 <tr bgcolor="#F2F2F2">
           <td><input type="submit" name="VacAprov" value="Executar"></td>
		 </tr>
    </table>
</form></tr>
</table>

<?php echo footer();?>